// pages/detail-video/index.js
import {getMVURL,getMVDetail,getRelatedVideo} from '../../service/api_video'

Page({

  /**
   * 页面的初始数据
   */
  data: {
    mvURLinfo: {},
    mvDetail: {},
    relatedVideos: [],
    danmuList:
    [{
      text: '音你心动，高能弹幕火爆来袭！！！',
      color: '#ff0000',
      time: 1
    }, {
      text: '范靖沙发',
      color: '#ff00ff',
      time: 3
    },
    {
      text: '陈育沙发',
      color: '#00000',
      time: 3
    },
    {
      text: '俺是第一',
      color: '#276478',
      time: 3
    },
    {
      text: '沙发沙发',
      color: '#737ac9',
      time: 3
    },
    {
      text: '前面xdm是的真滴快',
      color: '#099',
      time: 5,
     
    },],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //1.获取传入的id
  const id = options.id
  //2.获取页面数据
  this.getPageData(id)
  //其他逻辑
  },

  //网络请求
  getPageData:function(id){
    //1.请求播放地址
  getMVURL(id).then(res=>{
    this.setData({ mvURLinfo: res.data})
    })
    //2.请求视频信息
    getMVDetail(id).then(res=>{
      this.setData({ mvDetail: res.data})
    
    })
    //3.请求相关视频
    getRelatedVideo(id).then(res=>{
      this.setData({ relatedVideos: res.data})
     
    })
  },
  
})